﻿new Vue({
    el: "#divSupplementSetting",
    data: {
        form: sptSet,
        rules: {
            totalCount: [
                { required: true, message: '请输入总名额', trigger: 'blur' }
            ],
            applyCount: [
                { required: true, message: '请输入已申请数量', trigger: 'blur' }
            ],
            endTime: [
                { required: true, message: '请选择截止时间', trigger: 'change' }
            ]
        },
    }, mounted: function () {
        VmTop.navOn = 3;
    },
    methods: {
        //保存模板信息
        saveSupplementSetting: function () {
            that = this;
            this.$refs['form'].validate(function (valid) {
                if (valid) {
                    if (that.form.totalCount < that.form.applyCount) {
                        VmYz.message("已申请数量应小于总名额", false);
                        return;
                    }
                    that.loading = true;
                    $.post("/SupplementSetting/save", that.form, function (data) {
                        VmYz.message(data.msg, data.suc);
                        that.loading = false;
                    });
                }
            });
        },
    }
});